package ru.eas.packer;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

/**
 * @author aesipov
 */
public class TopLevelAlgorithm {

    class State implements Comparable {

        @Override
        public int compareTo(Object o) {
            return 0;  //To change body of implemented methods use File | Settings | File Templates.
        }
    }

    class Event {

    }

    public TopLevelAlgorithm(State firstState) {
        this.bestState = firstState;
    }

    private State bestState = new State();

    public void process(State state, Queue<Event> events) {
        if (events.isEmpty()) {
            stateCompetition(state);
            return;
        }
        Event event = events.poll();
        List<State> nextStates = getNextStates(state, event);
        if (!nextStates.isEmpty()) {
            for (State nextState : nextStates) {
                process(nextState, new LinkedList<Event>(events));
            }
        } else {
            stateCompetition(state);
        }
    }

    private List<State> getNextStates(State state, Event event) {
        return null;        
    }

    private void stateCompetition(State state) {
        if (state.compareTo(bestState) > 0) {
            bestState = state;
        }
    }
}
